package br.com.news.database.daos;

import javax.inject.Named;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;

import br.com.news.database.daos.interfaces.IFonteDao;
import br.com.news.database.entities.FonteEntity;
import br.com.news.database.utils.GenericDao;

@Named
public class FonteDao extends GenericDao<FonteEntity, Long> implements IFonteDao{

	@Override
	public FonteEntity buscaPorNome(String descricao) {
		Criteria criteria = super.getSession().createCriteria(FonteEntity.class);
		criteria.add(Restrictions.eq("descricao", descricao));
		return (FonteEntity) criteria.uniqueResult();
	}
	
}
